package com.landinfo.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;

/**
 * 专题图层服务管理
 * Create by wj
 * 2019-03-7
 */
@ApiModel(description = "专题图层服务管理 Create by wj 2019-03-7")
@Entity
@Table(name = "special_map_service_manage")
//@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SpecialMapServiceManage implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
//    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
//    @SequenceGenerator(name = "sequenceGenerator")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid2")
    private String id;

    /**
     * 模板类型(图层组/图层)
     */
    @ApiModelProperty(value = "模板类型")
    @Column(name = "template_type")
    private String templateType;

    /**
     * 图层组名称
     */
    @ApiModelProperty(value = "图层组名称")
    @Column(name = "special_map_group_name")
    private String specialMapGroupName;

    /**
     * 所属图层组
     */
    @ApiModelProperty(value = "所属图层组")
    @Column(name = "parent_id")
    private String parentId;

    /**
     * 专题图层名称
     */
    @ApiModelProperty(value = "专题图层名称")
    @Column(name = "name")
    private String name;

    /**
     * 专题图层类型
     */
    @ApiModelProperty(value = "专题图层类型")
    @Column(name = "jhi_type")
    private String type;

    /**
     * 专题图层地址
     */
    @ApiModelProperty(value = "专题图层地址")
    @Column(name = "url")
    private String url;

    /**
     * 地图标识
     */
    @ApiModelProperty(value = "初始化时是否显示图层")
    @Column(name = "mark")
    private String mark;

    /**
     * 可见度
     */
    @ApiModelProperty(value = "可见度")
    @Column(name = "opacity")
    private Integer opacity;

    /**
     * 初始化时是否显示图层
     */
    @ApiModelProperty(value = "初始化时是否显示图层")
    @Column(name = "visible")
    private Boolean visible;

    /**
     * 初始化时是否关闭透明度及子图层的面板
     */
    @ApiModelProperty(value = "初始化时是否关闭透明度及子图层的面板")
    @Column(name = "jhi_close")
    private Boolean close;

    /**
     * 该图层服务是否能上传图片
     */
    @ApiModelProperty(value = "该图层服务是否能上传图片")
    @Column(name = "can_upload_photo")
    private Boolean canUploadPhoto;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @Column(name = "jhi_sort")
    private Integer sort;

    /**
     * 是否启用
     */
    @ApiModelProperty(value = "是否启用")
    @Column(name = "jhi_enable")
    private Boolean enable;

    /**
     * 子级图层
     */
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name="parent_id")
    @OrderBy(value = "jhi_sort")
    private Set<SpecialMapServiceManage> children = new LinkedHashSet<SpecialMapServiceManage>();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTemplateType() {
        return templateType;
    }

    public SpecialMapServiceManage templateType(String templateType) {
        this.templateType = templateType;
        return this;
    }

    public void setTemplateType(String templateType) {
        this.templateType = templateType;
    }
    public String getSpecialMapGroupName() {
        return specialMapGroupName;
    }

    public SpecialMapServiceManage specialMapGroupName(String specialMapGroupName) {
        this.specialMapGroupName = specialMapGroupName;
        return this;
    }

    public void setSpecialMapGroupName(String specialMapGroupName) {
        this.specialMapGroupName = specialMapGroupName;
    }

    public String getName() {
        return name;
    }

    public SpecialMapServiceManage name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public SpecialMapServiceManage type(String type) {
        this.type = type;
        return this;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public SpecialMapServiceManage url(String url) {
        this.url = url;
        return this;
    }

    public void setUrl(String url) {
        this.url = url;
    }


    public String getMark() {
        return mark;
    }

    public SpecialMapServiceManage mark(String mark) {
        this.mark = mark;
        return this;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    public Integer getOpacity() {
        return opacity;
    }

    public SpecialMapServiceManage opacity(Integer opacity) {
        this.opacity = opacity;
        return this;
    }

    public void setOpacity(Integer opacity) {
        this.opacity = opacity;
    }

    public Boolean isVisible() {
        return visible;
    }

    public SpecialMapServiceManage visible(Boolean visible) {
        this.visible = visible;
        return this;
    }

    public void setVisible(Boolean visible) {
        this.visible = visible;
    }

    public Boolean isClose() {
        return close;
    }

    public SpecialMapServiceManage close(Boolean close) {
        this.close = close;
        return this;
    }

    public void setClose(Boolean close) {
        this.close = close;
    }

    public Boolean getCanUploadPhoto() {
        return canUploadPhoto;
    }

    public SpecialMapServiceManage canUploadPhoto(Boolean canUploadPhoto) {
        this.canUploadPhoto = canUploadPhoto;
        return this;
    }

    public void setCanUploadPhoto(Boolean canUploadPhoto) {
        this.canUploadPhoto = canUploadPhoto;
    }

    public Integer getSort() {
        return sort;
    }

    public SpecialMapServiceManage sort(Integer sort) {
        this.sort = sort;
        return this;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Boolean isEnable() {
        return enable;
    }

    public SpecialMapServiceManage enable(Boolean enable) {
        this.enable = enable;
        return this;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getParentId() {
        return parentId;
    }

    public SpecialMapServiceManage parentId(String parentId) {
        this.parentId = parentId;
        return this;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public Set<SpecialMapServiceManage> getChildren() {
        return children;
    }

    public void setChildren(Set<SpecialMapServiceManage> children) {
        this.children = children;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SpecialMapServiceManage specialMapServiceManage = (SpecialMapServiceManage) o;
        if (specialMapServiceManage.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), specialMapServiceManage.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "SpecialMapServiceManage{" +
            "id=" + getId() +
            ", templateType='" + getTemplateType() + "'" +
            ", specialMapGroupName='" + getSpecialMapGroupName() + "'" +
            ", parentId='" + getParentId() + "'" +
            ", name='" + getName() + "'" +
            ", type='" + getType() + "'" +
            ", url='" + getUrl() + "'" +
            ", mark='" + getMark() + "'" +
            ", opacity='" + getOpacity() + "'" +
            ", visible='" + isVisible() + "'" +
            ", close='" + isClose() + "'" +
            ", canUploadPhoto='" + getCanUploadPhoto() + "'" +
            ", sort='" + getSort() + "'" +
            ", enable='" + isEnable() + "'" +
            "}";
    }

}
